#import "BWInspectorPane.h"


@interface _BWInspectorPanePlaceholderView : NSView
{
    NSColor *background;
}

@end // _BWInspectorPanePlaceholderView

@implementation _BWInspectorPanePlaceholderView

- (id) initWithFrame: (NSRect) frame
{
    if (self = [super initWithFrame: frame]) {
        static int g_color;
        switch (g_color++ % 5) {
        case 0:
            background = [NSColor whiteColor];
            break;
        case 1:
            background = [NSColor purpleColor];
            break;
        case 2:
            background = [NSColor lightGrayColor];
            break;
        case 3:
            background = [NSColor brownColor];
            break;
        case 4:
            background = [NSColor orangeColor];
            break;
        }
        [background retain];
    }
    
    return (self);

} // initWithFrame

- (void) drawRect: (NSRect) rect
{
    NSRect bounds = [self bounds];
    [background set];
    [NSBezierPath fillRect: bounds];

    // just center a string for now
    NSString *blah;
    blah = [NSString stringWithFormat: @"Placeholder Pane (%p)", self];
    NSSize size = [blah sizeWithAttributes: nil];

    NSPoint startPoint;
    startPoint.x = bounds.origin.x + bounds.size.width / 2 - size.width / 2;
    startPoint.y = bounds.origin.y + bounds.size.height / 2 - size.height / 2;

    [blah drawAtPoint: startPoint
          withAttributes: nil];
    
    [[NSColor blackColor] set];
    [NSBezierPath strokeRect: bounds];

} // drawRect



@end // _BWInspectorPanePlaceholderView


@implementation BWInspectorPane

- (NSImage *) toolbarIcon
{
    static int s_blah;
    NSImage *image = nil;

    switch (s_blah++ % 5) {
    case 0:
        image = [[NSCursor openHandCursor] image];
        break;
    case 1:
        image = [[NSCursor closedHandCursor] image];
        break;
    case 2:
        image = [[NSCursor arrowCursor] image];
        break;
    case 3:
        image = [[NSCursor IBeamCursor] image];
        break;
    case 4:
        image = [[NSCursor disappearingItemCursor] image];
        break;
    }

    return (image);

} // toolbarIcon


- (NSView *) paneView
{
    if (paneView == nil) {
        int height;
        height = random() % 200 + 150;

        paneView = [[_BWInspectorPanePlaceholderView alloc]
                       initWithFrame: NSMakeRect (0, 0, 277, height)];
    }

    return (paneView);

} // paneView


- (void) setDocument: (BWBorkStitchDocument *) d
{
    document = d;
    [self updateUI];

} // setDocument


- (void) updateUI
{
} // updateUI


- (NSString *) paneName
{
    NSString *paneName;
    paneName = [NSString stringWithFormat: @"BWInspectorPane %p", self];

    return (paneName);

} // paneName


- (BOOL) isEqual: (id) theOther
{
    BOOL equal;
    equal = [[self paneName] isEqual: [theOther paneName]];

    return (equal);

} // isEqual


@end // BWInspectorPane
